/*****************************************************************************
 *
 * Copyright (C) 2003 CSHCN, University of Maryland.
 *
 * This program is free software; you can redistribute it and/or modify
 * it under the terms of the GNU General Public License as published by
 * the Free Software Foundation; either version 2 of the License, or
 * (at your option) any later version.
 *
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License
 * along with this program; if not, write to the Free Software
 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
 *
 * Authors: Dionysus Blazakis <dblaze@umd.edu>
 *          Jonathan Polley <jpolley@umd.edu>
 *          Dan Rusk <drusk@umd.edu>
 *          Manish Karir <karir@umd.edu>
 *
 *****************************************************************************/

#ifndef MAODV_EXT_H
#define MAODV_EXT_H

#ifndef NS_NO_GLOBALS
#include <endian.h>

#include "defs.h"

typedef struct _grp_leader_ext_t {
    u_int8_t type;
    u_int8_t length;
    u_int32_t grp_leader_addr;
    u_int32_t prev_hop_addr;
} grp_leader_ext;

typedef struct _grp_rebuild_ext_t {
    u_int8_t type;
    u_int8_t length;
    u_int16_t grp_hcnt;
} grp_rebuild_ext;

typedef struct _grp_info_ext_t {
    u_int8_t type;
    u_int8_t length;
    u_int32_t grp_hcnt;
    u_int32_t grp_leader_addr;
} grp_info_ext;

/* See note below. */
typedef struct _grp_merge_ext_t {
    u_int8_t type;
    u_int8_t length;
    u_int16_t res;
    u_int32_t grp_addr;
    u_int32_t grp_seqno;
} grp_merge_ext;

#define GRP_LEADER_EXT        (grp_leader_ext)
#define GRP_LEADER_EXT_SIZE   ( sizeof(GRP_LEADER_EXT) )
#define GLE_TYPE              ( 3 )
                              /* 2 = size of header */
#define GLE_LENGTH            (GRP_LEADER_EXT_SIZE - 2)  

#define GRP_REBUILD_EXT       grp_rebuild_ext
#define GRP_REBUILD_EXT_SIZE  ( sizeof(GRP_REBUILD_EXT) )
#define GRE_TYPE              ( 4 )
                              /* 2 = size of header */
#define GRE_LENGTH            (GRP_REBUILD_EXT_SIZE - 2)

#define GRP_INFO_EXT          (grp_info_ext)
#define GRP_INFO_EXT_SIZE     ( sizeof(GRP_INFO_EXT) )
#define GIE_TYPE              ( 5 )
                              /* 2 = size of header */
#define GIE_LENGTH            (GRP_INFO_EXT_SIZE - 2)

/* NOTE: This is a non-standard extension.  The draft is
   unclear about the tree merge process.  We have created
   a new extension for our tree merge.  The type number
   was chosen in an attempt to avoid collisions with any
   future extensions. */
#define GRP_MERGE_EXT         grp_merge_ext
#define GRP_MERGE_EXT_SIZE    ( sizeof(GRP_MERGE_EXT) )
#define GME_TYPE              ( 9 )
                              /* 2 = size of header */
#define GME_LENGTH            (GRP_MERGE_EXT_SIZE - 2)

#endif				/* NS_NO_GLOBALS */

#ifndef NS_NO_DECLARATIONS

#endif				/* NS_NO_DECLARATIONS */

#endif				/* MAODV_MACT_H */
